import React from 'react'
import ReactDOM from 'react-dom'
import './index.css'
import registerServiceWorker from './registerServiceWorker'
import Routers from '@/page/Routers'
import { createStore, applyMiddleware, } from 'redux'
import thunk from 'redux-thunk'
import { Provider, } from 'react-redux'
import reducer from '@/store/reducers'
import { getAllProducts } from '@/store/actions'

const middleware = [ thunk ]
const store = createStore(
  reducer,
  applyMiddleware(...middleware)
)

store.dispatch(getAllProducts())

ReactDOM.render(
  <Provider store={store}>
    <div>
      <Routers />
    </div>
  </Provider>
, document.getElementById('root'))
registerServiceWorker()
